//
//  AssistantTableViewCell.m
//  intelligent
//
//  Created by 甘世清 on 2024/2/7.
//

#import "AssistantTableViewCell.h"

@implementation AssistantTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)SQ_Style:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self.contentView.backgroundColor = UIColor.clearColor;
    [self.contentView addSubview:self.avatarImageView];
    [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(16);
        make.size.mas_equalTo(66);
        make.left.equalTo(self.contentView).offset(16);
    }];
    [self.contentView addSubview:self.topLabel];
    [self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.avatarImageView).offset(8);
        make.height.mas_equalTo(22);
        make.left.equalTo(self.contentView).offset(94);
    }];
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topLabel.mas_bottom).offset(8);
        make.left.equalTo(self.contentView).offset(94);
        make.right.equalTo(self.contentView.mas_right).offset(-16);
    }];
    self.FS_cellBottomView = self.messageLabel;
}

- (void)setModel:(AssistantModel *)model{
    _model = model;
    [self.avatarImageView sd_setImageWithURL:SQURLImage(model.icon)];
    self.topLabel.text = model.name;
    self.messageLabel.text = model.remark;
}


- (UIImageView *)avatarImageView{
    if (!_avatarImageView) {
        _avatarImageView = [[UIImageView alloc]init];
        _avatarImageView.clipsToBounds = YES;
        _avatarImageView.layer.cornerRadius = 22;
        _avatarImageView.layer.masksToBounds = YES;
        _avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _avatarImageView;
}
- (UILabel *)topLabel{
    if (!_topLabel) {
        _topLabel = [[UILabel alloc]init];
        _topLabel.font = FONT_MEDIUM(16);
        _topLabel.textColor = SQColor333333;
        _topLabel.backgroundColor = UIColor.clearColor;
        _topLabel.numberOfLines = 0;
//        _messageLabel.textAlignment = NSTextAlignmentRight;
    }
    return _topLabel;
}
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_REGULAR(14);
        _messageLabel.textColor = SQColor666666;
        _messageLabel.backgroundColor = UIColor.clearColor;
        _messageLabel.numberOfLines = 0;
//        _messageLabel.textAlignment = NSTextAlignmentRight;
    }
    return _messageLabel;
}
@end
